/**
 * o2oamazonclient.js
 * @NApiVersion 2.x
 */
define(['N/http', 'N/record','N/file','N/search','./common/moment'],
    function(http,record, file,search,moment) {
        var attributed = new Object();
        var method = new Object();

        attributed.ENV = "SANDBOX";
        attributed.URL = new Object();

        attributed.URL.AMAZON = {
            "SANDBOX":"http://112.74.55.237:8001",
            "PRODUCT":"http://112.74.55.237:8001"
        };
        attributed.URL.EBAY = {
            "SANDBOX":"http://112.74.55.237:8001",
            "PRODUCT":"http://112.74.55.237:8001"
        };

        attributed.URL.AMAZON.GET_ORDER = "/order/getOrder";
        attributed.URL.EBAY.GET_ORDER = "/order/getOrder";

        method.postApi = function(url,header,body){
            var headers = {};
            if(header!=null){
                headers = header;
            }
            headers['Content-Type'] = 'application/json';
            headers['Accept'] = '*/*';
            log.debug({
                title: 'psot request url',
                details: url
            });
            log.debug({
                title: 'psot request header',
                details: headers
            });
            log.debug({
                title: 'psot request body',
                details: body
            });
            var response = http.post({
                url: url,
                headers:headers,
                body:JSON.stringify(body)
            });
            log.debug({
                title: 'psot response',
                details: JSON.stringify(response)
            });
            return response;
        };
        method.deleteApi = function(env,url,header,body){
            var postURL = attributed.URL[env];
            postURL+= url;
            log.debug({
                title: 'delete request url',
                details: postURL
            });
            log.debug({
                title: 'delete request header',
                details: header
            });
            log.debug({
                title: 'delete request body',
                details: body
            });
            var response = http.delete({
                url: postURL,
                headers:header,
                body:body
            });
            log.debug({
                title: 'delete response',
                details: JSON.stringify(response)
            });
            return response;
        };
        method.getApi = function(env,url,header,body){

        };


        return {
            method: method,
            attributed: attributed
        };
    });